package com.dianping.cat.consumer.problem.model.entity;

import com.dianping.cat.consumer.problem.model.BaseEntity;
import com.dianping.cat.consumer.problem.model.IVisitor;
import java.util.LinkedHashMap;
import java.util.Map;


public class Entry
  extends BaseEntity<Entry>
{
  private String m_type;
  private String m_status;
/*  14 */   private Map<Integer, Duration> m_durations = new LinkedHashMap();

/*  16 */   private Map<String, JavaThread> m_threads = new LinkedHashMap();






/*  23 */   public void accept(IVisitor visitor) { visitor.visitEntry(this); }


  public Entry addDuration(Duration duration) {
/*  27 */     this.m_durations.put(Integer.valueOf(duration.getValue()), duration);
/*  28 */     return this;
  }

  public Entry addThread(JavaThread thread) {
    this.m_threads.put(thread.getId(), thread);
/*  33 */     return this;
  }


  public boolean equals(Object obj) {
/*  38 */     if (obj instanceof Entry) {
/*  39 */       Entry _o = (Entry)obj;

/*  41 */       if (!equals(getType(), _o.getType())) {
/*  42 */         return false;
      }

/*  45 */       if (!equals(getStatus(), _o.getStatus())) {
/*  46 */         return false;
      }

/*  49 */       if (!equals(getDurations(), _o.getDurations())) {
/*  50 */         return false;
      }

/*  53 */       if (!equals(getThreads(), _o.getThreads())) {
/*  54 */         return false;
      }


/*  58 */       return true;
    }

/*  61 */     return false;
  }


/*  65 */   public Duration findDuration(int value) { return (Duration)this.m_durations.get(Integer.valueOf(value)); }



/*  69 */   public JavaThread findThread(String id) { return (JavaThread)this.m_threads.get(id); }


  public Duration findOrCreateDuration(int value) {
/*  73 */     Duration duration = (Duration)this.m_durations.get(Integer.valueOf(value));

/*  75 */     if (duration == null) {
/*  76 */       synchronized (this.m_durations) {
/*  77 */         duration = (Duration)this.m_durations.get(Integer.valueOf(value));

/*  79 */         if (duration == null) {
/*  80 */           duration = new Duration(value);
/*  81 */           this.m_durations.put(Integer.valueOf(value), duration);
        }
      }
    }

/*  86 */     return duration;
  }

  public JavaThread findOrCreateThread(String id) {
/*  90 */     JavaThread thread = (JavaThread)this.m_threads.get(id);

/*  92 */     if (thread == null) {
/*  93 */       synchronized (this.m_threads) {
/*  94 */         thread = (JavaThread)this.m_threads.get(id);

/*  96 */         if (thread == null) {
/*  97 */           thread = new JavaThread(id);
/*  98 */           this.m_threads.put(id, thread);
        }
      }
    }

/* 103 */     return thread;
  }


/* 107 */   public Map<Integer, Duration> getDurations() { return this.m_durations; }



/* 111 */   public String getStatus() { return this.m_status; }



/* 115 */   public Map<String, JavaThread> getThreads() { return this.m_threads; }



/* 119 */   public String getType() { return this.m_type; }





  public void mergeAttributes(Entry other) {
/* 136 */     if (other.getType() != null) {
/* 137 */       this.m_type = other.getType();
    }

/* 140 */     if (other.getStatus() != null) {
/* 141 */       this.m_status = other.getStatus();
    }
  }


/* 146 */   public Duration removeDuration(int value) { return (Duration)this.m_durations.remove(Integer.valueOf(value)); }



/* 150 */   public JavaThread removeThread(String id) { return (JavaThread)this.m_threads.remove(id); }


  public Entry setStatus(String status) {
/* 154 */     this.m_status = status;
/* 155 */     return this;
  }

  public Entry setType(String type) {
/* 159 */     this.m_type = type;
/* 160 */     return this;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/problem/model/entity/Entry.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */